import {
  mallManagement
} from '@/Utils/Urls'
import _fetch from '@/Utils/Fetch'

export const uploadImage = (file) => {
  const formData = new FormData()
  formData.append('file', file)
  return _fetch({
    url: mallManagement.bookUploadImage,
    type: "post",
    data: formData,
    headers: {
      "Content-Type": "multipart/form-data"
    },
  })
}

export const addBook = (data) => {
  return _fetch({
    url: mallManagement.addBook,
    type: "post",
    isJson: true,
    data
  })
}
export const updateBook = (data) => {
  return _fetch({
    url: mallManagement.updateBook,
    type: "post",
    isJson: true,
    data
  })
}
export const deleteBook = (id) => {
  return _fetch({
    url: mallManagement.deleteBook + `/${id}`,
    type: "post",
    isJson: true
  })
}
export const reshowBook = (id) => {
  return _fetch({
    url: mallManagement.reshowBook + `/${id}`,
    type: "post",
    isJson: true
  })
}